home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
os2tools
/
bnklysrc
/
b_passwo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-03-04
|
7KB
|
162 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software <no-Inc> */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / No-Cost<no-tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* Copyright (C) 1987, 1988, 1989 by Robert Hartman and Vincent Perriello */
/* */
/* */
/* BinkleyTerm Password Processor */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.210. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHORS */
/* AT THE ADDRESSES LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO */
/* USE THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE */
/* BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU */
/* ARE ABLE TO REACH WITH THE AUTHORS. */
/* */
/* */
/* The Authors can be reached at the following addresses: */
/* */
/* Robert C. Hartman Vincent E. Perriello */
/* Spark Software VEP Software */
/* 427-3 Amherst Street 111 Carroll Street */
/* CS2032, Suite 232 Naugatuck, CT 06770 */
/* Nashua, NH 03061 */
/* */
/* FidoNet 1:132/101 FidoNet 1:141/491 */
/* Data (603) 888-8179 Data (203) 729-7569 */
/* */
/* Please feel free to contact us at any time to share your comments */
/* about our software and/or licensing policies. */
/* */
/* */
/* This module is based largely on a similar module in OPUS-CBCS V1.03b. */
/* The original work is (C) Copyright 1987, Wynn Wagner III. The original */
/* author has graciously allowed us to use his code in this work. */
/* */
/*--------------------------------------------------------------------------*/
#include <signal.h>
#include <ctype.h>
#include <conio.h>
#include <string.h>
#define WAZOO_SECTION
#include "com.h"
#include "xfer.h"
#include "zmodem.h"
#include "keybd.h"
#include "sbuf.h"
#include "sched.h"
#include "externs.h"
#include "prototyp.h"
static char *snitty_message = "Sorry, Charlie.";
static char *strnpbk (char *, int);
/*--------------------------------------------------------------------------*/
/* N PASSWORD */
/*--------------------------------------------------------------------------*/
int n_password (theirs, ours)
char *theirs;
char *ours;
{
if ((ours != NULL) && (ours[0]))
{
if ((theirs != NULL) && (theirs[0]))
{
strnpbk (theirs, 8); /* Get rid of trailing blanks */
strnpbk (ours, 8);
if (!strnicmp (theirs, ours, 8))
{
status_line ("*Password-protected session");
return 0;
}
}
status_line ("!Pwd Err (%d:%d/%d): %s/%s",
remote_zone,
remote_net,
remote_node,
theirs,
ours
);
SENDCHARS (snitty_message, strlen (snitty_message), 0);
while (!OUT_EMPTY () && CARRIER)
time_release ();
return 1;
}
return 0;
}
/*--------------------------------------------------------------------------*/
/* N GET PASSWORD */
/* Find the nodelist entry for this system and point remote_password at */
/* its password if any */
/*--------------------------------------------------------------------------*/
int n_getpassword (zone, net, node)
int zone, net, node;
{
extern char *remote_password;
extern struct _newnode newnodedes; /* desc. of node */
remote_password = NULL; /* Default to no password */
newnodedes.Password[0] = '\0';
if (!nodefind (zone, net, node, 0)) /* find the node in the list */
{
remote_password = NULL;
return (0); /* return failure if can't */
}
if (newnodedes.Password[0] != '\0') /* If anything there, */
{
remote_password = &newnodedes.Password[0]; /* Point at it */
return (1); /* Successful attempt */
}
else
{
/* No password involved */
return (0);
}
}
/*
* Strip all trailing blanks from a record.
*
*/
static char *strnpbk (string, n)
register char *string;
register int n;
{
string += n; /* point past end of string */
while (n--) /* now keep count */
{
if (*--string) /* if there's a character */
{
if (*string != ' ') /* if not a blank, we exit */
break;
*string = '\0'; /* if blank, terminate here */
}
}
return string;
}